package com.hyper_yang.javase.collections.set_collection.hashSet;

import com.hyper_yang.javase.collections.pojo.Student;

import java.util.LinkedHashSet;

public class TryLinkedHashSet {
    /*
    LinkedHashSet:
        1、哈希表: 数组 + 双向链表
        2、遍历的顺序: 插入的顺序   before、after
     */
    public static void main(String[] args) {
        Student stu1 = new Student("张三",23);
        Student stu2 = new Student("李四",24);
        Student stu3 = new Student("王五",25);
        Student stu4 = new Student("张三",23);

        LinkedHashSet<Student> linkedHashSet = new LinkedHashSet<>();
        linkedHashSet.add(stu1);
        linkedHashSet.add(stu2);
        linkedHashSet.add(stu3);
        linkedHashSet.add(stu4);

        System.out.println(linkedHashSet);
    }
}
